package com.qisu.command;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

/**
 *
 * @author alsan
 *
 */
@Component
public class CommandList {
	private Map<Integer, Command> list = new HashMap<>();

	public void addCommand(int id, Command cmd) {
		list.put(id, cmd);
	}

	public boolean isInitialized() {
		return list.size() > 0;
	}

	public boolean hasCommand(int id) {
		return list.containsKey(id);
	}

	public Command getCommand(int id) {
		if(hasCommand(id)) {
			return list.get(id);
		}
		return null;
	}
}
